package com.surenpi.jenkins.client.util;

import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.http.client.methods.HttpRequestBase;

public class RequestReleasingInputStream extends FilterInputStream {
   private final HttpRequestBase httpRequestBase;

   public RequestReleasingInputStream(InputStream in, HttpRequestBase httpRequestBase) {
      super(in);
      this.httpRequestBase = httpRequestBase;
   }

   public void close() throws IOException {
      super.close();
      this.httpRequestBase.releaseConnection();
   }
}
